package com.centersoft.flowable.core.model;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;


@Data
public class TaskComment {
    private String id;
    private String type; // 操作按钮编码
    private String commentType; //历史记录的类型
    private String status;        // 操作按钮文字
    private String message;    // 任务意见
    private String fullMessage; // status + '_FLOW_ACTION_' + message
    private String level; //显示级别 info danger success
    private String procInsId;
    private String userId;
    private Date createTime;
    public static final String prefix = "COMMENT_";



    public void setType(String type) {
        this.type = type;
        this.level = ActionType.getLevel(type);
    }

    public void setCommentType(String commentType) {
        if (commentType.startsWith(prefix)) {
            this.type = commentType.substring(prefix.length());
            this.level = ActionType.getLevel(type);
        }

    }

    public String getCommentType() {
        return prefix + type;
    }
}
